package main

func main() {
	println(integerReplacement(100))
}

func integerReplacement(n int) (res int) {
	for ; n != 1; n, res = n/2, res+1 {
		if n%2 == 0 {
			continue
		} else if (n-1)%4 == 0 || n == 3 {
			res++
			n -= 1
			continue
		} else {
			println(n)
			n += 1
			res++
			continue
		}
	}
	return
}
